﻿<?php 
include("../safe.php"); 
include("../action_save.php");
function check($str){
	return str_replace("'","''",$str);
}
$action=$_GET["action"];
$id=intval($_GET["id"]);
if($_POST['id']<>''){$ID_Dele=implode(",",$_POST['id']);}
$amount=$_POST["amount"];
$realamount=$_POST["realamount"];
$sa=round(($realamount-$amount)/$amount*100,2);
if($action=='add'){
$sql = "INSERT INTO ph_paylevel(amount,realamount,savelevel)VALUES('".$amount."','".$realamount."','".$sa."')";
mysql_query($sql,$conn);
insertaction($_SESSION["managername"],"新增充值比例",$conn);
echo "<script language=JavaScript>\r\n";
echo "location.href='list.php'\r\n";
echo "</script>";
}

// if($action=='edit'){
// $sql = "update ph_order set Status='".$Status."' where ID='".$id."'";
// mysql_query($sql,$conn);
// insertaction($_SESSION["managername"],"编辑订单".$orderno,$conn);
// echo "<script language=JavaScript>\r\n";
// echo "alert('修改成功!');\r\n";
// echo "location.href='list.php'\r\n";
// echo "</script>";
// }
if($action=='del'){
if($ID_Dele<>''){
$sql = "delete from ph_paylevel where id in(".$ID_Dele.")";
mysql_query($sql,$conn);}
if($id<>''){
$sql = "delete from ph_paylevel where id ='".$id."'";
mysql_query($sql,$conn);}
insertaction($_SESSION["managername"],"删除充值比例",$conn);
echo "<script language=JavaScript>\r\n";
echo "alert('删除成功!');\r\n";
echo "location.href='list.php'\r\n";
echo "</script>";
}
?>